function [intervals, class_sizes, class_count] = split(data_label)
    max_label = max(data_label);
    class_count = 0;
    help_matrix = [1:max_label; zeros(1, max_label)];
    [rows,columns] = size(data_label);
    for j = 1:1:rows,
        help_matrix(2, data_label(j)) = help_matrix(2, data_label(j)) + 1;
    end
    
    for i = 1:1:max_label,
        if help_matrix(2,i)~=0,
            class_count = class_count + 1;
        end
    end,
    
    class_sizes = zeros(2, class_count);
    counter = 1;
    for i = 1:max_label,
        if help_matrix(2,i)~=0,
            class_sizes(1:2,counter)=help_matrix(1:2,i);
            counter = counter + 1;
        end
    end

    intervals = zeros(class_count, 2);
    intervals(1,1) = 1;
    intervals(1,2) = class_sizes(2,1);

    for k = 2:class_count,
        intervals(k,1) = intervals(k-1,2) + 1;
        intervals(k,2) = intervals(k-1,2) + class_sizes(2,k);
    end
end